package com.dao.db1;

import com.pojo.UseClassify;
import com.pojo.UseDefinition;
import com.vo.Purposes;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface PurposesDao {
    //用途分类
    List<UseClassify> selectUseClassify();

    UseClassify selectClassifyId(@Param("id") int id);

    List<UseClassify> selectUserClassifyId(@Param("id") String id);

    //搜索上级分类
    UseClassify selectParentId(@Param("flmc") String flmc);

    //分类数量
    int getClassifyCount();

    UseClassify selectUseClassifyId(@Param("ytflbh") int ytflbh);

    //用途添加
    int insertClassify(
            @Param("ytflbh") int ytflbh,
            @Param("flmc") String flmc,
            @Param("state") int state,
            @Param("remark") String remark,
            @Param("level") int level,
            @Param("parentBh") int parentBh,
            @Param("lx") int lx);


    //用途分类修改
    int updateClassify(@Param("ytflbh") int ytflbh,
                       @Param("flmc") String flmc,
                       @Param("state") int state,
                       @Param("remark") String remark,
                       @Param("level") int level,
                       @Param("parentBh") int parentBh
    );

    //删除用途分类
    int deleteClassify(@Param("ytflbh") String ytflbh);

    //删除校验子节点
    Integer repeatClassifyParentBh(@Param("ytflbh") int ytflbh);

    //用途分类修改无上级分类
    int updateClfy(@Param("ytflbh") int ytflbh,
                   @Param("flmc") String flmc,
                   @Param("state") int state,
                   @Param("remark") String remark
    );

    //分类重复判定
    Integer repeatFlmc(@Param("flmc") String flmc);

    Integer repeatFlmcLevel(@Param("flmc") String flmc, @Param("level") int level);

    //用途定义
    List<UseDefinition> selectUseDefinition();

    List<Purposes> selectPurposes();


    List<UseDefinition> selectUseDefinitionFlmc(@Param("flmc") String flmc);

    //查询分类
    UseClassify selectYtfl(@Param("flmc") String flmc);

    //用途数量
    int getDefinitionCount();

    //添加用途定义
    int insertUseDefinition(
            @Param("ytbm") int ytbm,
            @Param("ytfl") String ytfl,
            @Param("ytmc") String ytmc,
            @Param("state") int state,
            @Param("remark") String remark,
            @Param("level") int level,
            @Param("fq") int fq,
            @Param("parentBh") int parentBh,
            @Param("lx") int lx);

    //修改用途
    int updateUseDefinition(@Param("ytbm") int ytbm,
                            @Param("ytfl") String ytfl,
                            @Param("ytmc") String ytmc,
                            @Param("state") int state,
                            @Param("remark") String remark,
                            @Param("fq") int fq);

    // 查询上级用途
    UseDefinition selectDefinition(@Param("sjyt") String sjyt);

    //用途定义删除
    int deleteDefinition(@Param("ytmc") String ytmc);

    //审核
    int updateState0(@Param("ytmc") String ytmc);

    int updateState1(@Param("ytmc") String ytmc);

    List<Purposes> getPurposes();

    //分页
    List<UseDefinition> pagination(@Param("limit") int limit, @Param("page") int page);

    //搜索
    List<UseDefinition> searchPagination(@Param("limit") int limit, @Param("page") int page, @Param("ytmc") String ytmc, @Param("ytbm") String ytbm, @Param("flmc") String flmc);
}
